/*
 * soc_script_type.h
 *
 *  Created on: 2019年4月7日
 *      Author: 0yfj0
 */

#ifndef _SOC_SCRIPT_TYPES_H_
#define _SOC_SCRIPT_TYPES_H_
#ifdef __cplusplus
extern "C"
{
#endif  /* __cplusplus */

/*----------------------------------------------------------------------------*/
#include <stdint.h>
#define SOC_SCRIPT_MAGIC ( 0x55AA55AA )
typedef enum
{
	SOC_SCRIPT_INT = 0,
	SOC_SCRIPT_DOUBLE,
	SOC_SCRIPT_BYTES,
} soc_script_vtype_t;

typedef struct
{
	int len;
	uint8_t *ptr;
} soc_script_bytes_t;

typedef struct soc_script_var
{
	struct soc_script_var *next;

	char name[8];
	soc_script_vtype_t type;
	union
	{
		int v_int;
		double v_double;
		soc_script_bytes_t v_bytes;
	} val;
} soc_script_var_t;

typedef enum
{
	SOC_SCRIPT_STAT_INIT = 0,
	SOC_SCRIPT_STAT_FUNC_MACHED,
	SOC_SCRIPT_STAT_FUNC_END,
} soc_script_stat_t;

typedef struct
{
	int err;
	soc_script_stat_t stat;
	soc_script_var_t *head;
	char *script;
	uint32_t magic;
} soc_script_scb_t;

/*----------------------------------------------------------------------------*/

#ifdef __cplusplus
}
#endif  /* __cplusplus */
#endif /* _SOC_SCRIPT_TYPES_H_ */
